// 1.引入Vue
import Vue from "vue";
// 引入vueRouter
import VueRouter from "vue-router"
// 2.引入路由组件
import Login from "../pages/Login"
import Home from "../pages/Home"
import Music from "../pages/Home/Music"
import News from "../pages/Home/News"
import List from "../pages/Home/List"

// 3.Vue中使用路由
Vue.use(VueRouter)

//4.创建路由对象
export default new VueRouter({
    routes:[
        {path:'/login',component:Login},
        {
            path:'/home',
            component:Home,
            children:[
                {path:'music/:id',component:Music,name:'music'},
                {path:'news',component:News,name:'news'},
                {
                    // props:true,
                    path:'list',
                    component:List,
                    name:'list',
                    props:(route)=>{
                        return  route.query
                    }
                },
                {path:"",redirect:"/home/news"}
                // {path:'',component:News}
            ]
        },
        {
            path: '/',
            redirect: '/home'
        }
    ]
})